package cn.com.cifi.mars.mapper.mars;

import java.time.LocalDateTime;
import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import cn.com.cifi.mars.entity.ProjectReturnCoefficient;
import cn.com.cifi.mars.entity.ReturnCoefficientDetail;


/**
 * <p>
 * 项目回款系数表 Mapper 接口
 * </p>
 *
 * @author JingYuanXiang
 * @since 2020-11-05
 */
public interface ProjectReturnCoefficientMapper extends BaseMapper<ProjectReturnCoefficient> {

    //查询回款系数版本列表
    List<ProjectReturnCoefficient> selectVersions( @Param("projectId") String projectId, @Param("isDel") int isDel,@Param("type") String type);

    //获取城市公司信息中的区域ID
    String getCityCompany(@Param("projectId") String projectId);

    //获取最新调整版版本状态
    ProjectReturnCoefficient getVersionStatus(@Param("projectId") String projectId,@Param("isDel") int isDel);

    //保存回款系数详情表
    void updateCoefficientDetail(@Param("proProductCode") String proProductCode, @Param("coefficientId") String coefficientId, @Param("param") ReturnCoefficientDetail param);

    //删除版本
    void delByVersionId(@Param("versionId") String versionId,@Param("userName") String userName, @Param("isDel") int isDel);

    //修改版本状态为编制中
    void updateByCoefficientId(@Param("coefficientId") String coefficientId, @Param("versionStatus") String versionStatus);

    //查询最新回款系数版本
    ProjectReturnCoefficient selectNewVersion(@Param("projectId") String projectId, @Param("isDel") int isDel);

    ProjectReturnCoefficient queryById(@Param("coefficientId") String coefficientId);

    List<ProjectReturnCoefficient> queryByProjectId(@Param("projectId") String projectId, @Param("isDel") int isDel);

    ProjectReturnCoefficient queryNewVersionByPojectId(@Param("projectId") String projectId, @Param("isDel") int isDel, @Param("versionType") String versionType);

    String queryProjectCodeByProjectId(@Param("projectId") String projectId, @Param("isDel") int isDel);

    List<String> getProjectIdList(@Param("hrOrgTypeId") String hrOrgTypeId);
    //获取最新回款系数版本点的回款系数详情列表
    List<ReturnCoefficientDetail> selectNewVersionCoefficientDetailList(@Param("projectId")String projectId,@Param("versionType") String versionType,
                                                                        @Param("versionState") String versionStatus,  @Param("isDel") int isDel);
    void updateStateByVersionId(@Param("versionId") String versionId, @Param("versionState") String versionState, @Param("now") LocalDateTime now);

    void updateToUpdateTime(@Param("coefficientId")String coefficientId, @Param("now")LocalDateTime now, @Param("username")String username);

    void updateTimeById(@Param("coefficientId")String coefficientId,@Param("now")LocalDateTime now);

    void updateVersionState(@Param("coefficientId")String coefficientId, @Param("username")String username, @Param("versionStateAfter")String versionStateAfter);

    //修改版本审批状态
    void updateCoefficientType(@Param("coefficientId") String coefficientId, @Param("type") String type, @Param("now") LocalDateTime now);

    void updateCoefficientTime(@Param("coefficientId") String coefficientId, @Param("now") LocalDateTime now);

    List<ProjectReturnCoefficient> selectLastTimeGroupByProjectId(@Param("versionType")String versionType,@Param("isDel") int isDel);
}
